package com.ruoyi.flexiblescheduling.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.flexiblescheduling.domain.MaskInfo;
import com.ruoyi.flexiblescheduling.service.IMaskInfoService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 掩膜信息Controller
 * 
 * @author Shijingming
 * @date 2024-01-27
 */
@RestController
@RequestMapping("/Mask_version_basic_information")
public class MaskInfoController extends BaseController
{
    @Autowired
    private IMaskInfoService maskInfoService;

    /**
     * 查询掩膜信息列表
     */
    @RequiresPermissions("flexiblescheduling:Mask_version_basic_information:list")
    @GetMapping("/list")
    public TableDataInfo list(MaskInfo maskInfo)
    {
        startPage();
        List<MaskInfo> list = maskInfoService.selectMaskInfoList(maskInfo);
        return getDataTable(list);
    }

    /**
     * 导出掩膜信息列表
     */
    @RequiresPermissions("flexiblescheduling:Mask_version_basic_information:export")
    @Log(title = "掩膜信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, MaskInfo maskInfo)
    {
        List<MaskInfo> list = maskInfoService.selectMaskInfoList(maskInfo);
        ExcelUtil<MaskInfo> util = new ExcelUtil<MaskInfo>(MaskInfo.class);
        util.exportExcel(response, list, "掩膜信息数据");
    }

    /**
     * 获取掩膜信息详细信息
     */
    @RequiresPermissions("flexiblescheduling:Mask_version_basic_information:query")
    @GetMapping(value = "/{ID}")
    public AjaxResult getInfo(@PathVariable("ID") Long ID)
    {
        return success(maskInfoService.selectMaskInfoByID(ID));
    }

    /**
     * 新增掩膜信息
     */
    @RequiresPermissions("flexiblescheduling:Mask_version_basic_information:add")
    @Log(title = "掩膜信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody MaskInfo maskInfo)
    {
        return toAjax(maskInfoService.insertMaskInfo(maskInfo));
    }

    /**
     * 修改掩膜信息
     */
    @RequiresPermissions("flexiblescheduling:Mask_version_basic_information:edit")
    @Log(title = "掩膜信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody MaskInfo maskInfo)
    {
        return toAjax(maskInfoService.updateMaskInfo(maskInfo));
    }

    /**
     * 删除掩膜信息
     */
    @RequiresPermissions("flexiblescheduling:Mask_version_basic_information:remove")
    @Log(title = "掩膜信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{IDs}")
    public AjaxResult remove(@PathVariable Long[] IDs)
    {
        return toAjax(maskInfoService.deleteMaskInfoByIDs(IDs));
    }
}
